import type { EggAppConfig, EggAppInfo, PowerPartial } from 'egg'

export default (appInfo: EggAppInfo) => {
  const config = {
    keys: `${appInfo.name}_1696916897649_7224`,
    middleware: ['noSafari'],
    view: {
      defaultViewEngine: 'nunjucks',
      mapping: {
        '.tpl': 'nunjucks',
      },
    },
    /* customer */
    noSafari: {
      ua: [/AppleWebKit\/605.1.15/i],
    },
    news: {
      pageSize: 5,
      serverUrl: 'https://hacker-news.firebaseio.com/v0',
    },
  } as PowerPartial<EggAppConfig>

  return config
}
